\(\int \frac {(A+B x) \sqrt {a^2+2 a b x+b^2 x^2}}{x^2} \, dx\) [659]

   Optimal result
   Rubi [A] (verified)
   Mathematica [B] (verified)
   Maple [C] (warning: unable to verify)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [B] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 29, antiderivative size = 103 \[ \int \frac {(A+B x) \sqrt {a^2+2 a b x+b^2 x^2}}{x^2} \, dx=-\frac {a A \sqrt {a^2+2 a b x+b^2 x^2}}{x (a+b x)}+\frac {b B x \sqrt {a^2+2 a b x+b^2 x^2}}{a+b x}+\frac {(A b+a B) \sqrt {a^2+2 a b x+b^2 x^2} \log (x)}{a+b x} \]

[Out]

-a*A*((b*x+a)^2)^(1/2)/x/(b*x+a)+b*B*x*((b*x+a)^2)^(1/2)/(b*x+a)+(A*b+B*a)*ln(x)*((b*x+a)^2)^(1/2)/(b*x+a)

Rubi [A] (verified)

Time = 0.03 (sec) , antiderivative size = 103, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.069, Rules used = {784, 77} \[ \int \frac {(A+B x) \sqrt {a^2+2 a b x+b^2 x^2}}{x^2} \, dx=\frac {\log (x) \sqrt {a^2+2 a b x+b^2 x^2} (a B+A b)}{a+b x}-\frac {a A \sqrt {a^2+2 a b x+b^2 x^2}}{x (a+b x)}+\frac {b B x \sqrt {a^2+2 a b x+b^2 x^2}}{a+b x} \]

[In]

Int[((A + B*x)*Sqrt[a^2 + 2*a*b*x + b^2*x^2])/x^2,x]

[Out]

-((a*A*Sqrt[a^2 + 2*a*b*x + b^2*x^2])/(x*(a + b*x))) + (b*B*x*Sqrt[a^2 + 2*a*b*x + b^2*x^2])/(a + b*x) + ((A*b
 + a*B)*Sqrt[a^2 + 2*a*b*x + b^2*x^2]*Log[x])/(a + b*x)

Rule 77

Int[((d_.)*(x_))^(n_.)*((a_) + (b_.)*(x_))*((e_) + (f_.)*(x_))^(p_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*
x)*(d*x)^n*(e + f*x)^p, x], x] /; FreeQ[{a, b, d, e, f, n}, x] && IGtQ[p, 0] && (NeQ[n, -1] || EqQ[p, 1]) && N
eQ[b*e + a*f, 0] && ( !IntegerQ[n] || LtQ[9*p + 5*n, 0] || GeQ[n + p + 1, 0] || (GeQ[n + p + 2, 0] && Rational
Q[a, b, d, e, f])) && (NeQ[n + p + 3, 0] || EqQ[p, 1])

Rule 784

Int[((d_.) + (e_.)*(x_))^(m_.)*((f_.) + (g_.)*(x_))*((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_), x_Symbol] :> Dis
t[(a + b*x + c*x^2)^FracPart[p]/(c^IntPart[p]*(b/2 + c*x)^(2*FracPart[p])), Int[(d + e*x)^m*(f + g*x)*(b/2 + c
*x)^(2*p), x], x] /; FreeQ[{a, b, c, d, e, f, g, m}, x] && EqQ[b^2 - 4*a*c, 0]

Rubi steps \begin{align*} \text {integral}& = \frac {\sqrt {a^2+2 a b x+b^2 x^2} \int \frac {\left (a b+b^2 x\right ) (A+B x)}{x^2} \, dx}{a b+b^2 x} \\ & = \frac {\sqrt {a^2+2 a b x+b^2 x^2} \int \left (b^2 B+\frac {a A b}{x^2}+\frac {b (A b+a B)}{x}\right ) \, dx}{a b+b^2 x} \\ & = -\frac {a A \sqrt {a^2+2 a b x+b^2 x^2}}{x (a+b x)}+\frac {b B x \sqrt {a^2+2 a b x+b^2 x^2}}{a+b x}+\frac {(A b+a B) \sqrt {a^2+2 a b x+b^2 x^2} \log (x)}{a+b x} \\ \end{align*}

Mathematica [B] (verified)

Leaf count is larger than twice the leaf count of optimal. \(761\) vs. \(2(103)=206\).

Time = 1.21 (sec) , antiderivative size = 761, normalized size of antiderivative = 7.39 \[ \int \frac {(A+B x) \sqrt {a^2+2 a b x+b^2 x^2}}{x^2} \, dx=\frac {2 \left (a^2\right )^{3/2} A+3 a \sqrt {a^2} A b x+\sqrt {a^2} A b^2 x^2-2 a \sqrt {a^2} b B x^2-2 \sqrt {a^2} b^2 B x^3-2 a^2 A \sqrt {(a+b x)^2}-a A b x \sqrt {(a+b x)^2}+2 a b B x^2 \sqrt {(a+b x)^2}-2 (A b+a B) x \left (a^2+a b x-\sqrt {a^2} \sqrt {(a+b x)^2}\right ) \text {arctanh}\left (\frac {b x}{\sqrt {a^2}-\sqrt {(a+b x)^2}}\right )-2 (A b+a B) x \left (\sqrt {a^2} b x+a \left (\sqrt {a^2}-\sqrt {(a+b x)^2}\right )\right ) \log (x)+\left (a^2\right )^{3/2} B x \log \left (\sqrt {a^2}-b x-\sqrt {(a+b x)^2}\right )+a \sqrt {a^2} b B x^2 \log \left (\sqrt {a^2}-b x-\sqrt {(a+b x)^2}\right )-a^2 B x \sqrt {(a+b x)^2} \log \left (\sqrt {a^2}-b x-\sqrt {(a+b x)^2}\right )+a \sqrt {a^2} A b x \log \left (a \left (\sqrt {a^2}-b x-\sqrt {(a+b x)^2}\right )\right )+\sqrt {a^2} A b^2 x^2 \log \left (a \left (\sqrt {a^2}-b x-\sqrt {(a+b x)^2}\right )\right )-a A b x \sqrt {(a+b x)^2} \log \left (a \left (\sqrt {a^2}-b x-\sqrt {(a+b x)^2}\right )\right )+\left (a^2\right )^{3/2} B x \log \left (\sqrt {a^2}+b x-\sqrt {(a+b x)^2}\right )+a \sqrt {a^2} b B x^2 \log \left (\sqrt {a^2}+b x-\sqrt {(a+b x)^2}\right )-a^2 B x \sqrt {(a+b x)^2} \log \left (\sqrt {a^2}+b x-\sqrt {(a+b x)^2}\right )+a \sqrt {a^2} A b x \log \left (a \left (\sqrt {a^2}+b x-\sqrt {(a+b x)^2}\right )\right )+\sqrt {a^2} A b^2 x^2 \log \left (a \left (\sqrt {a^2}+b x-\sqrt {(a+b x)^2}\right )\right )-a A b x \sqrt {(a+b x)^2} \log \left (a \left (\sqrt {a^2}+b x-\sqrt {(a+b x)^2}\right )\right )}{2 x \left (a^2+a b x-\sqrt {a^2} \sqrt {(a+b x)^2}\right )} \]

[In]

Integrate[((A + B*x)*Sqrt[a^2 + 2*a*b*x + b^2*x^2])/x^2,x]

[Out]

(2*(a^2)^(3/2)*A + 3*a*Sqrt[a^2]*A*b*x + Sqrt[a^2]*A*b^2*x^2 - 2*a*Sqrt[a^2]*b*B*x^2 - 2*Sqrt[a^2]*b^2*B*x^3 -
 2*a^2*A*Sqrt[(a + b*x)^2] - a*A*b*x*Sqrt[(a + b*x)^2] + 2*a*b*B*x^2*Sqrt[(a + b*x)^2] - 2*(A*b + a*B)*x*(a^2
+ a*b*x - Sqrt[a^2]*Sqrt[(a + b*x)^2])*ArcTanh[(b*x)/(Sqrt[a^2] - Sqrt[(a + b*x)^2])] - 2*(A*b + a*B)*x*(Sqrt[
a^2]*b*x + a*(Sqrt[a^2] - Sqrt[(a + b*x)^2]))*Log[x] + (a^2)^(3/2)*B*x*Log[Sqrt[a^2] - b*x - Sqrt[(a + b*x)^2]
] + a*Sqrt[a^2]*b*B*x^2*Log[Sqrt[a^2] - b*x - Sqrt[(a + b*x)^2]] - a^2*B*x*Sqrt[(a + b*x)^2]*Log[Sqrt[a^2] - b
*x - Sqrt[(a + b*x)^2]] + a*Sqrt[a^2]*A*b*x*Log[a*(Sqrt[a^2] - b*x - Sqrt[(a + b*x)^2])] + Sqrt[a^2]*A*b^2*x^2
*Log[a*(Sqrt[a^2] - b*x - Sqrt[(a + b*x)^2])] - a*A*b*x*Sqrt[(a + b*x)^2]*Log[a*(Sqrt[a^2] - b*x - Sqrt[(a + b
*x)^2])] + (a^2)^(3/2)*B*x*Log[Sqrt[a^2] + b*x - Sqrt[(a + b*x)^2]] + a*Sqrt[a^2]*b*B*x^2*Log[Sqrt[a^2] + b*x
- Sqrt[(a + b*x)^2]] - a^2*B*x*Sqrt[(a + b*x)^2]*Log[Sqrt[a^2] + b*x - Sqrt[(a + b*x)^2]] + a*Sqrt[a^2]*A*b*x*
Log[a*(Sqrt[a^2] + b*x - Sqrt[(a + b*x)^2])] + Sqrt[a^2]*A*b^2*x^2*Log[a*(Sqrt[a^2] + b*x - Sqrt[(a + b*x)^2])
] - a*A*b*x*Sqrt[(a + b*x)^2]*Log[a*(Sqrt[a^2] + b*x - Sqrt[(a + b*x)^2])])/(2*x*(a^2 + a*b*x - Sqrt[a^2]*Sqrt
[(a + b*x)^2]))

Maple [C] (warning: unable to verify)

Result contains higher order function than in optimal. Order 9 vs. order 3.

Time = 0.14 (sec) , antiderivative size = 44, normalized size of antiderivative = 0.43

method result size
default \(\frac {\operatorname {csgn}\left (b x +a \right ) \left (A \ln \left (-b x \right ) b x +B \ln \left (-b x \right ) a x +B b \,x^{2}+a B x -a A \right )}{x}\) \(44\)
risch \(-\frac {a A \sqrt {\left (b x +a \right )^{2}}}{x \left (b x +a \right )}+\frac {b B x \sqrt {\left (b x +a \right )^{2}}}{b x +a}+\frac {\left (A b +B a \right ) \ln \left (x \right ) \sqrt {\left (b x +a \right )^{2}}}{b x +a}\) \(71\)

[In]

int((B*x+A)*((b*x+a)^2)^(1/2)/x^2,x,method=_RETURNVERBOSE)

[Out]

csgn(b*x+a)*(A*ln(-b*x)*b*x+B*ln(-b*x)*a*x+B*b*x^2+a*B*x-a*A)/x

Fricas [A] (verification not implemented)

none

Time = 0.30 (sec) , antiderivative size = 26, normalized size of antiderivative = 0.25 \[ \int \frac {(A+B x) \sqrt {a^2+2 a b x+b^2 x^2}}{x^2} \, dx=\frac {B b x^{2} + {\left (B a + A b\right )} x \log \left (x\right ) - A a}{x} \]

[In]

integrate((B*x+A)*((b*x+a)^2)^(1/2)/x^2,x, algorithm="fricas")

[Out]

(B*b*x^2 + (B*a + A*b)*x*log(x) - A*a)/x

Sympy [F]

\[ \int \frac {(A+B x) \sqrt {a^2+2 a b x+b^2 x^2}}{x^2} \, dx=\int \frac {\left (A + B x\right ) \sqrt {\left (a + b x\right )^{2}}}{x^{2}}\, dx \]

[In]

integrate((B*x+A)*((b*x+a)**2)**(1/2)/x**2,x)

[Out]

Integral((A + B*x)*sqrt((a + b*x)**2)/x**2, x)

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 175 vs. \(2 (70) = 140\).

Time = 0.20 (sec) , antiderivative size = 175, normalized size of antiderivative = 1.70 \[ \int \frac {(A+B x) \sqrt {a^2+2 a b x+b^2 x^2}}{x^2} \, dx=\left (-1\right )^{2 \, b^{2} x + 2 \, a b} B a \log \left (2 \, b^{2} x + 2 \, a b\right ) + \left (-1\right )^{2 \, b^{2} x + 2 \, a b} A b \log \left (2 \, b^{2} x + 2 \, a b\right ) - \left (-1\right )^{2 \, a b x + 2 \, a^{2}} B a \log \left (\frac {2 \, a b x}{{\left | x \right |}} + \frac {2 \, a^{2}}{{\left | x \right |}}\right ) - \left (-1\right )^{2 \, a b x + 2 \, a^{2}} A b \log \left (\frac {2 \, a b x}{{\left | x \right |}} + \frac {2 \, a^{2}}{{\left | x \right |}}\right ) + \sqrt {b^{2} x^{2} + 2 \, a b x + a^{2}} B - \frac {\sqrt {b^{2} x^{2} + 2 \, a b x + a^{2}} A}{x} \]

[In]

integrate((B*x+A)*((b*x+a)^2)^(1/2)/x^2,x, algorithm="maxima")

[Out]

(-1)^(2*b^2*x + 2*a*b)*B*a*log(2*b^2*x + 2*a*b) + (-1)^(2*b^2*x + 2*a*b)*A*b*log(2*b^2*x + 2*a*b) - (-1)^(2*a*
b*x + 2*a^2)*B*a*log(2*a*b*x/abs(x) + 2*a^2/abs(x)) - (-1)^(2*a*b*x + 2*a^2)*A*b*log(2*a*b*x/abs(x) + 2*a^2/ab
s(x)) + sqrt(b^2*x^2 + 2*a*b*x + a^2)*B - sqrt(b^2*x^2 + 2*a*b*x + a^2)*A/x

Giac [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 47, normalized size of antiderivative = 0.46 \[ \int \frac {(A+B x) \sqrt {a^2+2 a b x+b^2 x^2}}{x^2} \, dx=B b x \mathrm {sgn}\left (b x + a\right ) + {\left (B a \mathrm {sgn}\left (b x + a\right ) + A b \mathrm {sgn}\left (b x + a\right )\right )} \log \left ({\left | x \right |}\right ) - \frac {A a \mathrm {sgn}\left (b x + a\right )}{x} \]

[In]

integrate((B*x+A)*((b*x+a)^2)^(1/2)/x^2,x, algorithm="giac")

[Out]

B*b*x*sgn(b*x + a) + (B*a*sgn(b*x + a) + A*b*sgn(b*x + a))*log(abs(x)) - A*a*sgn(b*x + a)/x

Mupad [B] (verification not implemented)

Time = 10.34 (sec) , antiderivative size = 207, normalized size of antiderivative = 2.01 \[ \int \frac {(A+B x) \sqrt {a^2+2 a b x+b^2 x^2}}{x^2} \, dx=B\,\sqrt {a^2+2\,a\,b\,x+b^2\,x^2}-B\,\ln \left (a\,b+\frac {a^2}{x}+\frac {\sqrt {a^2}\,\sqrt {a^2+2\,a\,b\,x+b^2\,x^2}}{x}\right )\,\sqrt {a^2}+A\,\ln \left (a\,b+\sqrt {{\left (a+b\,x\right )}^2}\,\sqrt {b^2}+b^2\,x\right )\,\sqrt {b^2}-\frac {A\,\sqrt {a^2+2\,a\,b\,x+b^2\,x^2}}{x}+\frac {B\,a\,b\,\ln \left (a\,b+\sqrt {{\left (a+b\,x\right )}^2}\,\sqrt {b^2}+b^2\,x\right )}{\sqrt {b^2}}-\frac {A\,a\,b\,\ln \left (a\,b+\frac {a^2}{x}+\frac {\sqrt {a^2}\,\sqrt {a^2+2\,a\,b\,x+b^2\,x^2}}{x}\right )}{\sqrt {a^2}} \]

[In]

int((((a + b*x)^2)^(1/2)*(A + B*x))/x^2,x)

[Out]

B*(a^2 + b^2*x^2 + 2*a*b*x)^(1/2) - B*log(a*b + a^2/x + ((a^2)^(1/2)*(a^2 + b^2*x^2 + 2*a*b*x)^(1/2))/x)*(a^2)
^(1/2) + A*log(a*b + ((a + b*x)^2)^(1/2)*(b^2)^(1/2) + b^2*x)*(b^2)^(1/2) - (A*(a^2 + b^2*x^2 + 2*a*b*x)^(1/2)
)/x + (B*a*b*log(a*b + ((a + b*x)^2)^(1/2)*(b^2)^(1/2) + b^2*x))/(b^2)^(1/2) - (A*a*b*log(a*b + a^2/x + ((a^2)
^(1/2)*(a^2 + b^2*x^2 + 2*a*b*x)^(1/2))/x))/(a^2)^(1/2)